﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private async void Form1_Load(object sender, EventArgs e)
        {
            await Show1();
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }
        public async Task Show1()
        {
            await Task.Run(() =>
            {
                MessageBox.Show("我是一个无参");
            });
        }
        private async void button2_Click(object sender, EventArgs e)
        {
            string zhi = await Show2(10);
            MessageBox.Show(zhi);
        }
        public async Task<string> Show2(int a)
        {
            await Task.Run(() => {
                MessageBox.Show("我是一个有参又返回");
            });
            return "这是我的返回,参数是:" + a;
        }

    }
}
